<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册 - 外卖APP</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #f5f5f5;
            font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            color: #333;
        }
        .phone-container {
            width: 390px;
            height: 844px;
            margin: 20px auto;
            background: white;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0 20px rgba(0,0,0,0.1);
            border-radius: 40px;
        }
        .content {
            height: 100%;
            overflow-y: auto;
            background-color: white;
            display: flex;
            flex-direction: column;
        }
        .header {
            padding: 16px;
            display: flex;
            align-items: center;
        }
        .back-btn {
            color: #666;
            text-decoration: none;
            font-size: 24px;
            display: flex;
            align-items: center;
        }
        .header-title {
            flex: 1;
            text-align: center;
            font-size: 18px;
            font-weight: 600;
            margin-right: 24px;
        }
        .register-container {
            padding: 20px 30px;
            flex: 1;
        }
        .logo-area {
            text-align: center;
            margin-bottom: 40px;
        }
        .app-logo {
            width: 80px;
            height: 80px;
            border-radius: 20px;
            background: #0095ff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 15px;
            box-shadow: 0 4px 15px rgba(0, 149, 255, 0.2);
        }
        .app-logo i {
            font-size: 40px;
            color: white;
        }
        .app-name {
            font-size: 24px;
            font-weight: 600;
            color: #333;
        }
        .app-slogan {
            font-size: 14px;
            color: #999;
            margin-top: 5px;
        }
        .register-title {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 10px;
        }
        .register-subtitle {
            font-size: 14px;
            color: #999;
            margin-bottom: 30px;
        }
        .form-group {
            margin-bottom: 20px;
        }
        .form-label {
            font-size: 14px;
            color: #666;
            margin-bottom: 8px;
        }
        .form-input {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            font-size: 15px;
            transition: all 0.3s ease;
        }
        .form-input:focus {
            border-color: #0095ff;
            box-shadow: 0 0 0 2px rgba(0, 149, 255, 0.1);
            outline: none;
        }
        .form-input::placeholder {
            color: #ccc;
        }
        .code-input-group {
            display: flex;
            gap: 10px;
        }
        .code-input {
            flex: 1;
        }
        .code-btn {
            width: 120px;
            background: #f5f5f5;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            color: #666;
            font-size: 14px;
            cursor: pointer;
        }
        .code-btn:disabled {
            color: #999;
            cursor: not-allowed;
        }
        .register-btn {
            width: 100%;
            padding: 13px;
            background: #0095ff;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 500;
            margin-top: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .register-btn:hover {
            background: #0085e5;
        }
        .register-btn:disabled {
            background: #ccc;
            cursor: not-allowed;
        }
        .login-link {
            margin-top: 20px;
            text-align: center;
            font-size: 14px;
            color: #666;
        }
        .login-link a {
            color: #0095ff;
            text-decoration: none;
        }
        .agreement-check {
            display: flex;
            align-items: flex-start;
            margin-top: 20px;
            gap: 10px;
        }
        .agreement-check input {
            margin-top: 3px;
        }
        .agreement-text {
            font-size: 13px;
            color: #666;
            line-height: 1.5;
        }
        .agreement-text a {
            color: #0095ff;
            text-decoration: none;
        }
        .password-rules {
            font-size: 12px;
            color: #999;
            margin-top: 5px;
            line-height: 1.5;
        }
        .password-strength {
            display: flex;
            gap: 5px;
            margin-top: 10px;
        }
        .strength-bar {
            height: 4px;
            flex: 1;
            background: #eee;
            border-radius: 2px;
        }
        .strength-bar.active {
            background: #0095ff;
        }
        .strength-bar.weak {
            background: #ff4d4f;
        }
        .strength-bar.medium {
            background: #faad14;
        }
        .strength-bar.strong {
            background: #52c41a;
        }
        .strength-text {
            font-size: 12px;
            color: #999;
            margin-top: 5px;
        }
    </style>
</head>
<body>
    <div class="phone-container">
        <div class="content">
            <div class="header">
                <a href="login.html" class="back-btn">
                    <i class="bi bi-chevron-left"></i>
                </a>
                <div class="header-title">注册账号</div>
                <div style="width: 24px;"></div>
            </div>

            <div class="register-container">
                <div class="logo-area">
                    <div class="app-logo">
                        <i class="bi bi-bag"></i>
                    </div>
                    <div class="app-name">外卖APP</div>
                    <div class="app-slogan">美食随时送到家</div>
                </div>
                
                <div class="register-title">欢迎注册</div>
                <div class="register-subtitle">注册后享受更多优质服务</div>

                <div class="form-group">
                    <div class="form-label">手机号</div>
                    <input type="tel" class="form-input" id="phone-input" placeholder="请输入手机号" maxlength="11">
                </div>
                <div class="form-group">
                    <div class="form-label">验证码</div>
                    <div class="code-input-group">
                        <input type="text" class="form-input code-input" id="code-input" placeholder="请输入验证码" maxlength="6">
                        <button class="code-btn" id="code-btn">获取验证码</button>
                    </div>
                </div>
                <div class="form-group">
                    <div class="form-label">设置密码</div>
                    <input type="password" class="form-input" id="password-input" placeholder="请设置登录密码">
                    <div class="password-rules">
                        密码长度8-20位，必须包含字母、数字
                    </div>
                    <div class="password-strength">
                        <div class="strength-bar" id="strength-1"></div>
                        <div class="strength-bar" id="strength-2"></div>
                        <div class="strength-bar" id="strength-3"></div>
                    </div>
                    <div class="strength-text" id="strength-text">密码强度：弱</div>
                </div>

                <div class="agreement-check">
                    <input type="checkbox" id="agreement-checkbox">
                    <div class="agreement-text">
                        我已阅读并同意<a href="#">《用户协议》</a>、<a href="#">《隐私政策》</a>和<a href="#">《食品安全协议》</a>
                    </div>
                </div>

                <button class="register-btn" id="register-btn" disabled>注册</button>

                <div class="login-link">
                    已有账号？<a href="login.html">立即登录</a>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 验证码倒计时
        const codeBtn = document.getElementById('code-btn');
        codeBtn.addEventListener('click', function() {
            if (this.disabled) return;
            
            // 获取手机号
            const phoneInput = document.getElementById('phone-input');
            const phone = phoneInput.value.trim();
            
            // 简单验证手机号
            if (!/^1\d{10}$/.test(phone)) {
                alert('请输入正确的手机号');
                return;
            }
            
            // 开始倒计时
            let countdown = 60;
            this.disabled = true;
            this.textContent = `${countdown}秒后重新获取`;
            
            const timer = setInterval(() => {
                countdown--;
                this.textContent = `${countdown}秒后重新获取`;
                
                if (countdown <= 0) {
                    clearInterval(timer);
                    this.disabled = false;
                    this.textContent = '获取验证码';
                }
            }, 1000);
            
            // 这里可以添加发送验证码的逻辑
            console.log('发送验证码到手机号：' + phone);
        });

        // 密码强度检测
        const passwordInput = document.getElementById('password-input');
        const strengthBar1 = document.getElementById('strength-1');
        const strengthBar2 = document.getElementById('strength-2');
        const strengthBar3 = document.getElementById('strength-3');
        const strengthText = document.getElementById('strength-text');

        passwordInput.addEventListener('input', function() {
            const password = this.value;
            let strength = 0;
            
            // 检查密码长度
            if (password.length >= 8) strength++;
            
            // 检查是否包含字母和数字
            if (/[a-zA-Z]/.test(password) && /[0-9]/.test(password)) strength++;
            
            // 检查是否包含特殊字符
            if (/[^a-zA-Z0-9]/.test(password)) strength++;
            
            // 更新强度条
            strengthBar1.className = 'strength-bar';
            strengthBar2.className = 'strength-bar';
            strengthBar3.className = 'strength-bar';
            
            if (strength >= 1) {
                strengthBar1.className = 'strength-bar weak';
            }
            if (strength >= 2) {
                strengthBar1.className = 'strength-bar medium';
                strengthBar2.className = 'strength-bar medium';
            }
            if (strength >= 3) {
                strengthBar1.className = 'strength-bar strong';
                strengthBar2.className = 'strength-bar strong';
                strengthBar3.className = 'strength-bar strong';
            }
            
            // 更新强度文本
            if (strength === 0) strengthText.textContent = '密码强度：弱';
            else if (strength === 1) strengthText.textContent = '密码强度：弱';
            else if (strength === 2) strengthText.textContent = '密码强度：中';
            else strengthText.textContent = '密码强度：强';
        });

        // 协议勾选
        const agreementCheckbox = document.getElementById('agreement-checkbox');
        const registerBtn = document.getElementById('register-btn');
        
        agreementCheckbox.addEventListener('change', function() {
            registerBtn.disabled = !this.checked;
        });

        // 注册按钮点击事件
        registerBtn.addEventListener('click', function() {
            // 获取表单数据
            const phone = document.getElementById('phone-input').value.trim();
            const code = document.getElementById('code-input').value.trim();
            const password = document.getElementById('password-input').value;
            
            // 简单验证
            if (!phone || !/^1\d{10}$/.test(phone)) {
                alert('请输入正确的手机号');
                return;
            }
            
            if (!code || code.length !== 6) {
                alert('请输入正确的验证码');
                return;
            }
            
            if (!password || password.length < 8) {
                alert('请设置符合要求的密码');
                return;
            }
            
            // 这里可以添加注册逻辑
            alert('注册成功！');
            window.location.href = 'login.html';
        });
    </script>
</body>
</html> 